#include <iostream>
#include "util.hpp"
#include "service.hpp"

void util_test()
{
    std::ifstream ifs;
    ifs.open("testfile.txt");
    std::string content;
    ifs.seekg(0, std::ios::end);
    size_t len = ifs.tellg();
    ifs.seekg(0, std::ios::beg);
    content.resize(len);
    ifs.read(&content[0], len);

    cloud::FileUtil file1("output/test1");
    file1.SetContent(content);
    file1.Compress("output/pack");
}



void ServiceTest()
{
    cloud::Service srv;
    srv.RunModule();
}

void initLogger()
{
    Log::GlobalBuilder builder(Log::LoggerTpye::LOGGER_ASYNC);
    builder.buildLoggerName("globalLogger"); // 内部定义的日志器名称
    builder.buildSink<Log::FileSink>("./logfile/cloud.log");
    builder.build();
}


int main(int argc, char *argv[])
{
    initLogger();
    std::thread thread_service(ServiceTest); // 运行服务模块
    thread_service.join();
    
    return 0;
}